package com.freeman.cement.exception;

/**
 * @author 66
 */
public class AppException extends RuntimeException{

    private int code = 500;
    private String msg = "服务器异常";

    //建议抛出枚举类定义的异常
    public AppException(AppExceptionCodeMsg appExceptionCodeMsg){
        super();
        this.code = appExceptionCodeMsg.getCode();
        this.msg = appExceptionCodeMsg.getMsg();

    }

    public AppException(AppExceptionCodeMsg appExceptionCodeMsg, String detail){
        super();
        this.code = appExceptionCodeMsg.getCode();
        this.msg = appExceptionCodeMsg.getMsg() + ":" +detail;

    }

    //不建议直接抛出未经枚举类定义的异常
    public AppException(int code, String msg){
        super();
        this.code = code;
        this.msg = msg;

    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

}
